package example;

public class MyServiceProxy extends MyService {
    private final MyService target;
    private static final LogAspect LOG_ASPECT = new LogAspect();
    public MyServiceProxy(MyService target) {
        this.target = target;
    }
    boolean isMatch(String methodName) {
        if(methodName.equals("add1")) {
            return true;//add1有@log
        }
        return false;//add2没有@log
    }
    public void add1(Object vo, Object option) {
        if(isMatch("add1")) { // 判断是否命中切点
            LOG_ASPECT.logBefore();
        }
        target.add1(vo,option);
    }
    public void add2(Object vo) {
        if(isMatch("add2")) { // 判断是否命中切点
            LOG_ASPECT.logBefore();
        }
        target.add2(vo);
    }
}
